<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditItemTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <!-- start of the form notifications -->
            
            <!-- end of the form notifications -->
            
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <center><h1>تعديل المنتج </h1></center>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.EditItemLabel_itemName}" for="itemName" />
                    <h:inputText id="itemName" value="#{itemController.selected.itemName}" title="#{bundle.EditItemTitle_itemName}" required="true" requiredMessage="#{bundle.EditItemRequiredMessage_itemName}"/>
                     <h:outputLabel value="#{bundle.CreateItemLabel_itemType}" for="itemType" />
                    
                    
                   
                   <h:selectOneMenu id="itemType" value="#{itemController.selected.itemType}" title="#{bundle.CreateItemTitle_itemType}" >
                        <f:selectItems value="#{itemController.types}"/>
                       
                    </h:selectOneMenu>
                      <h:outputLabel value="#{bundle.CreateItemLabel_countryID}" for="countryID" />
                    <h:selectOneMenu id="countryID" value="#{itemController.selected.countryID}" title="#{bundle.CreateItemTitle_countryID}" >
                        <f:selectItems value="#{countryController.itemsAvailableSelectOne}"/>
                        <f:ajax render="factoryID" listener="#{itemController.itemListener}" event="valueChange"/>
                    </h:selectOneMenu>
                    <h:outputLabel  value="#{bundle.CreateItemLabel_factoryID}" for="factoryID" />
                    <h:selectOneMenu id="factoryID" value="#{itemController.factoryid}" title="#{bundle.CreateItemTitle_factoryID}" >
                        <f:selectItems value="#{itemController.factoryList}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <center>
                <h:commandLink action="#{itemController.update}" value="#{bundle.EditItemSaveLink}" class="btn btn-primary"/>
                
                <h:commandLink action="#{itemController.prepareList}" value="#{bundle.EditItemShowAllLink}" immediate="true" class="btn btn-primary"/>
                </center>   
            </h:form>
             
            
        </ui:define>
    </ui:composition>

</html>
